package com.lxx.onlineview.mapper;

import com.lxx.onlineview.entity.po.Course;
import java.util.List;

import org.apache.ibatis.annotations.*;

@Mapper
public interface CourseMapper {
    @InsertProvider(value = CourseProvider.class,method = "insert")
    int insert(Course record);

    @Select("select * from course where name = #{course}")
    Course selectByPrimaryKey(@Param("id") Integer id, @Param("name") String name);

    @Select("select * from course")
    List<Course> selectAll();

    @Select("select * from course where name in (select course as name from student_course where student = #{student})")
    List<Course> selectByStudent(String student);

    @Select("select * from course where course in (select course from teach where teacher = #{teacher})")
    List<Course> selectByTeacher(String teacher);

    @UpdateProvider(value = CourseProvider.class,method = "update")
    int updateByPrimaryKey(Course record);


}
